<route lang="json5" type="page">
	{
	layout: 'default',
	style: {
	navigationBarTitleText: '',
	navigationStyle: 'custom',
	disableScroll: true, // 微信禁止页面滚动
	'app-plus': {
	bounce: 'none', // 禁用 iOS 弹性效果
	},
	},
	}
</route>

<template>
	<PageLayout :navbarShow="false">
		<!-- <view class="wrap" :style="{
        '--nav-height': `${statusBarHeight + navHeight}px`,
        '--status-bar-height': `${statusBarHeight}px`,
      }">
		</view> -->
		<view class="index-container">
			<span class="title" :style="{
			'margin-top':`${rightButtonMarginTopHeight + 30}px`
		  }">盛荣CCER</span>
			<swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="5000"
				:duration="500">
				<!--本地配置轮播图-->
				<swiper-item v-for="(item, index) in swiperList" :key="index" v-if="isLocalConfig">
					<image class="swiper-image-item" :src="item.url" mode="aspectFill" v-if="item.type == 'image'">
					</image>
					<video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false"
						objectFit="cover" v-if="item.type == 'video'"></video>
				</swiper-item>
				<!--线上配置轮播图-->
				<!-- <swiper-item v-for="(item, index) in carouselList" :key="index" v-if="!isLocalConfig">
					<image :src="getFileAccessHttpUrl(item)" mode="aspectFill"></image>
				</swiper-item> -->
			</swiper>
			<view class="news">
				<span class="text">资讯丨</span>
				<view class="notice-container">
					<wd-notice-bar direction="vertical" :text="textArray" :delay="3" custom-class="space"
						background-color="#fff" color="#333333">
						<template #suffix>
							<span style="color:#9c9c9c">
								<wd-icon name="chevron-right" size="22px"></wd-icon>
							</span>
						</template>
					</wd-notice-bar>
				</view>
			</view>
			<view class="servise">
				<view class="servise-tab">
					<span>服务</span>
					<span style="color:#a4a4a4">
						更多
						<wd-icon name="chevron-right" size="22px"></wd-icon>
					</span>
				</view>
				<view class="servise-content">
					<view class="grid-container">
						<view class="grid-item" v-for="(item, index) in swiperList" :key="index">
							<image class="grid-image" :src="item.url" mode="aspectFill">
							</image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</PageLayout>
</template>

<script lang="ts" setup>
	import { ref } from 'vue'
	import { platform, isMp } from '@/utils/platform'
	import { useRouter } from '@/plugin/uni-mini-router'
	import { useParamsStore } from '@/store/page-params'

	defineOptions({
		name: 'message',
		options: {
			// apply-shared‌：当前页面样式会影响到子组件样式.(小程序)
			// shared‌：当前页面样式影响到子组件，子组件样式也会影响到当前页面.(小程序)
			styleIsolation: '‌shared‌',
		},
	})

	const swiperList = ref([])
	const textArray = ref([])
	const isLocalConfig = getApp().globalData.isLocalConfig;
	if (isLocalConfig) {
		swiperList.value = [
			{
				id: 1,
				type: 'image',
				url: '/static/banner1.png',
				link: '',
			},
			{
				id: 2,
				type: 'image',
				url: '/static/banner2.png',
				link: '',
			},
			{
				id: 3,
				type: 'image',
				url: '/static/banner3.png',
				link: '',
			},
			{
				id: 4,
				type: 'image',
				url: '/static/banner4.png',
				link: '',
			},
		]
		textArray.value = ['这是一条信息1', '这是一条信息2', '这是一条信息3', '这是一条信息4']
	} else {
	}

	const paramsStore = useParamsStore()
	const router = useRouter()
	const globalData = getApp().globalData
	const { systemInfo, navHeight } = globalData
	const { statusBarHeight } = systemInfo
	const rightButtonMarginTopHeight = ref(0)
	onLoad(() => {
		const rightButton = uni.getMenuButtonBoundingClientRect()
		rightButtonMarginTopHeight.value = rightButton.top
	})
</script>

<style lang="scss" scoped>
	.swiper {
		width: 100%;
		height: 375upx;
		flex: none;
		border-radius: 18upx;

		image,
		video {
			width: 100%;
			display: block;
			height: 100%;
			margin: 0;
		}

		:deep(.uni-swiper-dot) {
			transition: all 400ms ease;
			background-color: rgba(255, 255, 255, 0.4);
			width: 5px;
			height: 5px;
			border-radius: 50%;
			margin: 0 4px;
		}

		:deep(.uni-swiper-dot-active) {
			background-color: rgba(255, 255, 255, 1);
			width: 16px;
			border-radius: 2px;
		}
	}

	.index-container {
		width: 100%;
		height: 100%;
		padding: 26upx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		flex-direction: column;
		gap: 20upx;

		.title {
			width: 100%;
			height: 60upx;
			font-size: 36upx;
			color: #FFF;
			margin-top: 80upx;
			display: flex;
			z-index: 999;
			justify-content: center;
			align-items: center;
		}

		.news {
			margin-top: 10upx;
			width: 100%;
			display: flex;
			align-items: center;
			background-color: #FFF;
			box-sizing: border-box;
			border-radius: 18upx;
			padding: 0 26upx;
			justify-content: space-between;
			box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;

			.text {
				margin-bottom: 4upx;
			}

			.notice-container {
				width: calc(100% - 42px);
				flex: 1;

				.space {
					width: 100%;
				}
			}
		}



		.servise {
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;


			.servise-tab {
				margin-top: 10upx;
				box-sizing: border-box;
				padding: 0 10upx;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;

				span {
					display: flex;
					align-items: center;
					justify-content: space-between;

					&:nth-child(1) {
						font-size: 40upx;
					}
				}
			}

			.servise-content {
				margin-top: 20upx;
				height: 100%;

				.grid-container {
					display: flex;
					width: 100%;
					height: 100%;
					flex-wrap: wrap;
					justify-content: space-between;
				}

				.grid-item {
					width: 48%;
					height: calc((100% - 20upx) / 2);
					margin-bottom: 20upx;
					background-color: #f5f5f5;
					border-radius: 18upx;
					overflow: hidden;
				}

				.grid-image {
					width: 100%;
					height: 100%;
					display: block;
					object-fit: cover;
				}
			}
		}
	}
</style>